SELECT ORG_POST."ID", FORMMAIN_2357.FIELD0001 name,FORMMAIN_2357.FIELD0002 code ,
(CASE WHEN FORMMAIN_2357.FIELD0006 = '2' THEN '1' ELSE '0' END) state
FROM FORMMAIN_2357
LEFT JOIN ORG_POST ON ORG_POST.CODE = FORMMAIN_2357.FIELD0002 AND ORG_POST.IS_DELETED = 0
WHERE ORG_POST.CODE IS NOT NULL AND 
(
ORG_POST."NAME" != FORMMAIN_2357.FIELD0001 OR 
(CASE WHEN FORMMAIN_2357.FIELD0006 = '2' THEN '1' ELSE '0' END) != ORG_POST.IS_ENABLE 
)